<template>
	<view>
		<view class="margin-bottom10">
			<u-tabs :list="tabsList" @click="tabsClick" :current="tabIndex"></u-tabs>
		</view>
		<!-- 健康数据 -->
		<template v-if="tabIndex == 0">
			<view class="padding-30">
				<!-- 健康数据 -->
				<view class="bg-fff padding-30 border-radius20 margin-bottom30">
					<view class="fontSize-15 color-000 margin-bottom30">身高</view>
					<view class="flex-between padding-30 border-radius20" style="background-color: #F3F8FF;">
						<view>
							<view class="flex-alignItems-center margin-bottom20">
								<view class="margin-right30">
									<view class="fontSize-16 color-000 margin-bottom10 fontWeight-bold">
										{{health_data.weight.height?health_data.weight.height:'暂无记录'}}</view>
									<view class="fontSize-15 color-999">身高/cm</view>
								</view>
								<view>
									<view class="fontSize-16 color-000 margin-bottom10 fontWeight-bold">
										{{health_data.weight.weight?health_data.weight.weight:'暂无记录'}}</view>
									<view class="fontSize-15 color-999">体重/kg</view>
								</view>
							</view>
							<view>
								<view class="fontSize-16 color-000 margin-bottom10 fontWeight-bold">
									{{health_data.weight.BMI?health_data.weight.BMI:'暂无记录'}}</view>
								<view class="fontSize-15 color-999">BMI</view>
							</view>
						</view>
						<view class="flex-justAliCenter-column" @click="healthShow = true">
							<image class="img-68 margin-bottom20" src="../../../../static/image/12.png" mode=""></image>
							<view class="fontSize-15 color-808080">记录</view>
						</view>
					</view>
				</view>
				<view class="bg-fff padding-30 border-radius20 margin-bottom30"
					@click="$tools.navigateTo('/pages/mine/mine-list/health-records/blood-list')">
					<view class="fontSize-15 color-000 margin-bottom30">血压</view>
					<view class="flex-between padding-30 border-radius20" style="background-color: #F3F8FF;">
						<view>
							<view class="flex-alignItems-center margin-bottom20">
								<view class="margin-right30">
									<view class="fontSize-16 color-000 margin-bottom10 fontWeight-bold">
										{{health_data.pressure.pressure_shou?health_data.pressure.pressure_shou:'暂无记录'}}
									</view>
									<view class="fontSize-15 color-999">收缩压/mmHg</view>
								</view>
								<view>
									<view class="fontSize-16 color-000 margin-bottom10 fontWeight-bold">
										{{health_data.pressure.pressure_shu?health_data.pressure.pressure_shu:'暂无记录'}}
									</view>
									<view class="fontSize-15 color-999">舒张压/mmHg</view>
								</view>
							</view>
							<view class="flex-alignItems-center">
								<view class="margin-right30">
									<view class="fontSize-16 color-000 margin-bottom10 fontWeight-bold">
										{{health_data.pressure.pressure_date?health_data.pressure.pressure_date:'暂无记录'}}
									</view>
									<view class="fontSize-15 color-999">实际检测时间</view>
								</view>
								<view>
									<view class="fontSize-16 color-000 margin-bottom10 fontWeight-bold">
										{{health_data.pressure.heart_rate?health_data.pressure.heart_rate:'暂无记录'}}
									</view>
									<view class="fontSize-15 color-999">心率</view>
								</view>
							</view>
						</view>
						<view class="flex-justAliCenter-column" @click.stop="bloodShow = true">
							<image class="img-68 margin-bottom20" src="../../../../static/image/12.png" mode=""></image>
							<view class="fontSize-15 color-808080">记录</view>
						</view>
					</view>
				</view>
				<view class="bg-fff padding-30 border-radius20"
					@click="$tools.navigateTo('/pages/mine/mine-list/health-records/heart-list')">
					<view class="fontSize-15 color-000 margin-bottom30">心率</view>
					<view class="flex-between padding-30 border-radius20" style="background-color: #F3F8FF;">
						<view class="flex-alignItems-center">
							<view class="flex-justAliCenter-column margin-right30">
								<view class="fontSize-16 color-000 margin-bottom10 fontWeight-bold">
									{{health_data.rate.heart_rate?health_data.rate.heart_rate:'暂无记录'}}</view>
								<view class="fontSize-15 color-999">心率/bmp</view>
							</view>
							<view class="flex-justAliCenter-column">
								<view class="fontSize-16 color-000 margin-bottom10 fontWeight-bold">
									{{health_data.rate.heart_date?health_data.rate.heart_date:'暂无记录'}}</view>
								<view class="fontSize-15 color-999">实际检测时间</view>
							</view>
						</view>
						<view class="flex-justAliCenter-column" @click.stop="heartRateShow = true">
							<image class="img-68 margin-bottom20" src="../../../../static/image/12.png" mode=""></image>
							<view class="fontSize-15 color-808080">记录</view>
						</view>
					</view>
				</view>
			</view>
		</template>
		<!-- 现病史 -->
		<template v-if="tabIndex == 1">
			<view class="padding-30">
				<!-- 现病史 -->
				<view class="bg-fff padding-30 border-radius20 margin-bottom30" v-if="disease_detail.id"
					@click="$tools.navigateTo('/pages/mine/mine-list/health-records/history-present-illness?code=现病史编辑'+'&id='+disease_detail.id)">
					<view class="fontSize-15 color-000 margin-bottom30">{{disease_detail.tags}}</view>
					<view class="padding-30 border-radius20" style="background-color: #F3F8FF;">
						<view class="fontSize-15 color-000 margin-bottom30">病史时间：{{disease_detail.tag_date}}</view>
						<view class="fontSize-15 color-000">病症其他描述：{{disease_detail.describe}}</view>
					</view>
				</view>
				<view class="margin-top150" v-else>
					<null-view></null-view>
				</view>
				<!-- 底部操作栏 -->
				<view style="height: 200rpx;"></view>
				<view class="position-fixed-bottom padding-30 bg-fff" v-if="!disease_detail.id"
					@click="$tools.navigateTo('/pages/mine/mine-list/health-records/history-present-illness')">
					<view class="btn50-0165FD-15ffffff flex-center">
						管理病症
					</view>
				</view>
			</view>
		</template>
		<!-- 健康史 -->
		<template v-if="tabIndex == 2">
			<view class="padding-30">
				<!-- 健康史 -->
				<view class="bg-fff padding-30 border-radius20 margin-bottom30" v-if="history_detail.id"
					@click="$tools.navigateTo('/pages/mine/mine-list/health-records/health-add?code=健康史编辑'+'&id='+history_detail.id)">
					<view class="padding-30 border-radius20" style="background-color: #F3F8FF;">
						<view class="fontSize-15 color-000 margin-bottom30">过往病史：{{history_detail.disease_history}}
						</view>
						<view class="fontSize-15 color-000 margin-bottom30">
							家族病史：{{history_detail.family_disease_history}}</view>
						<view class="fontSize-15 color-000 margin-bottom30">过敏史：{{history_detail.allergy_history}}
						</view>
						<view class="fontSize-15 color-000 margin-bottom30">手术史：{{history_detail.operation_history}}
						</view>
						<view class="fontSize-15 color-000 margin-bottom30">排便情况：{{history_detail.defecate}}</view>
						<view class="fontSize-15 color-000">排尿情况：{{history_detail.micturition}}</view>
					</view>
				</view>
				<view class="margin-top150" v-else>
					<null-view></null-view>
				</view>
				<!-- 底部操作栏 -->
				<view style="height: 200rpx;"></view>
				<view class="position-fixed-bottom padding-30 bg-fff" v-if="!history_detail.id">
					<view class="btn50-0165FD-15ffffff flex-center"
						@click="$tools.navigateTo('/pages/mine/mine-list/health-records/health-add')">
						编辑健康史
					</view>
				</view>
			</view>
		</template>
		<!-- 生活方式 -->
		<template v-if="tabIndex == 3">
			<view class="padding-30">
				<!-- 现病史 -->
				<view class="bg-fff padding-30 border-radius20 margin-bottom30" v-if="live_detail.id"
					@click="$tools.navigateTo('/pages/mine/mine-list/health-records/live-add?code=生活方式编辑'+'&id='+live_detail.id)">
					<view class="padding-30 border-radius20" style="background-color: #F3F8FF;">
						<view class="fontSize-15 color-000 margin-bottom30">是否抽烟：{{live_detail.is_smoking}}</view>
						<view class="fontSize-15 color-000 margin-bottom30">是否饮酒：{{live_detail.is_tipple}}</view>
						<view class="fontSize-15 color-000 margin-bottom30">口味偏好：{{live_detail.taste}}</view>
						<view class="fontSize-15 color-000 margin-bottom30">运动习惯：{{live_detail.movement}}</view>
						<view class="fontSize-15 color-000 margin-bottom30">睡眠时长：{{live_detail.sleep}}</view>
					</view>
				</view>
				<view class="margin-top150" v-else>
					<null-view></null-view>
				</view>
				<!-- 底部操作栏 -->
				<view style="height: 200rpx;"></view>
				<view class="position-fixed-bottom padding-30 bg-fff" v-if="!live_detail.id">
					<view class="btn50-0165FD-15ffffff flex-center"
						@click="$tools.navigateTo('/pages/mine/mine-list/health-records/live-add')">
						编辑生活方式
					</view>
				</view>
			</view>
		</template>
		<!-- 门诊记录 -->
		<template v-if="tabIndex == 4">
			<view class="padding-30">
				<view class="flex-between margin-bottom30 padding-30 bg-fff border-radius20"
					@click="$tools.navigateTo('/pages/mine/mine-list/health-records/bind-doctors')">
					<view class="fontSize-15 color-000">首诊医生</view>
					<view class="flex-alignItems-center">
						<view class="fontSize-15 color-999 margin-right10">选择首诊医生</view>
						<u-icon name="arrow-right" color="#999999" size="20"></u-icon>
					</view>
				</view>

				<view class="padding-30 border-radius20 bg-fff margin-bottom30" v-if="false">
					<view class="flex-alignItems-center margin-bottom30">
						<view class="fontSize-15 color-000 margin-right10">首诊医生</view>
						<view class="fontSize-13" style="color: #FF7070;">绑定成功后7日内修改一次</view>
					</view>
					<view class="flex-alignItems-center padding-30 border-radius20" style="background-color: #F3F8FF;">
						<image class="img-100 border-50radius" src="../../../../static/image/user.png" mode=""></image>
						<view class="margin-left20">
							<view class="fontSize-18 color-000 fontWeight-bold margin-bottom20">周恣意</view>
							<view class="fontSize-15 color-999">内科</view>
						</view>
					</view>
				</view>

				<!-- 现病史 -->
				<view class="bg-fff padding-30 border-radius20 margin-bottom30">
					<view class="flex-between margin-bottom30">
						<view class="fontSize-15 color-000">这里是报告名称</view>
						<image class="img-44" src="../../../../static/image/13.png" mode=""></image>
					</view>
					<view class="padding-30 border-radius20" style="background-color: #F3F8FF;">
						<view class="fontSize-15 color-000 margin-bottom30">就诊科室：内科</view>
						<view class="fontSize-15 color-000 margin-bottom30">病情描述：血糖</view>
						<view class="fontSize-15 color-000 margin-bottom30">诊断：一级糖尿病</view>
						<view class="fontSize-15 color-000 margin-bottom30">就诊时间：2024-01-01</view>
						<view class="fontSize-15 color-000 margin-bottom30">就诊报告：图片2张</view>
						<view class="flex-flex-warp">
							<image class="img-160 border-radius10 image-view" src="../../../../static/logo.png" mode="">
							</image>
							<image class="img-160 border-radius10 image-view" src="../../../../static/logo.png" mode="">
							</image>
							<image class="img-160 border-radius10 image-view" src="../../../../static/logo.png" mode="">
							</image>
							<image class="img-160 border-radius10 image-view" src="../../../../static/logo.png" mode="">
							</image>
						</view>
					</view>
				</view>
				<!-- 底部操作栏 -->
				<view style="height: 200rpx;"></view>
				<view class="position-fixed-bottom padding-30 bg-fff"
					@click="$tools.navigateTo('/pages/mine/mine-list/health-records/add-outpatient-records')">
					<view class="btn50-0165FD-15ffffff flex-center">
						添加就医报告
					</view>
				</view>
			</view>
		</template>
		<!-- 门诊报告 -->
		<template v-if="tabIndex == 5">
			<view class="padding-30">
				<!-- 现病史 -->
				<view class="bg-fff padding-30 border-radius20 margin-bottom30" v-for="(item,index) in list" :key="index"
				@click="$tools.navigateTo('/pages/mine/mine-list/health-records/add-outpatient-report?id='+item.id)">
					<view class="flex-between margin-bottom30">
						<view class="fontSize-15 color-000">{{item.check_name}}</view>
						<image class="img-44" src="../../../../static/image/13.png" mode="" @click.stop="deleteTijianDel(item.id)"></image>
					</view>
					<view class="padding-30 border-radius20" style="background-color: #F3F8FF;">
						<view class="fontSize-15 color-000 margin-bottom30">体检时间：{{item.check_date}}</view>
						<view class="fontSize-15 color-000 margin-bottom30">体检报告：图片{{item.images.length}}张</view>
						<view class="flex-flex-warp">
							<image class="img-160 border-radius10 image-view" v-for="(v,i) in item.images" :key="i" :src="v" mode="">
							</image>
						</view>
					</view>
				</view>
				<u-empty v-if="list.length == 0"
				        mode="list"
				        icon="http://cdn.uviewui.com/uview/empty/list.png"
						width="150px"
						height="150px"
						text="列表为空"
						textSize="18"
				>
				</u-empty>
				<view style="padding-bottom: 100rpx;">
					<u-loadmore v-if="loading" status="loading" />
					<u-loadmore v-if="isLastPage" status="nomore" />
				</view>
				<!-- 底部操作栏 -->
				<view style="height: 200rpx;"></view>
				<view class="position-fixed-bottom padding-30 bg-fff"
					@click="$tools.navigateTo('/pages/mine/mine-list/health-records/add-outpatient-report')">
					<view class="btn50-0165FD-15ffffff flex-center">
						添加体检报告
					</view>
				</view>
			</view>
		</template>
		<!-- 用药方案 -->
		<template v-if="tabIndex == 6">
			<!-- 用药方案 -->
			<view class="padding-30">
				<view class="bg-fff padding-30 border-radius20 margin-bottom30" v-for="(item,index) in list" :key="index"
				@click="$tools.navigateTo('/pages/mine/mine-list/health-records/add-medication-plan?id=' + item.id)">
					<view class="flex-between margin-bottom30">
						<view class="fontSize-15 color-000">{{item.medicine_name}}</view>
						<image class="img-44" src="../../../../static/image/13.png" mode="" @click.stop="medicineDel(item.id)"></image>
					</view>
					<view class="padding-30 border-radius20" style="background-color: #F3F8FF;">
						<view class="fontSize-15 color-000 margin-bottom30">用药开始时间：{{item.medicine_start_date}}</view>
						<view class="fontSize-15 color-000 margin-bottom30">用药结束时间：{{item.medicine_end_date}}</view>
						<view class="fontSize-15 color-000 margin-bottom30">药品用量：{{item.medicine_dosage}}</view>
						<view class="fontSize-15 color-000 margin-bottom30">用药频率：{{item.medicine_frequency}}</view>
					</view>
				</view>
				<u-empty v-if="list.length == 0"
				        mode="list"
				        icon="http://cdn.uviewui.com/uview/empty/list.png"
						width="150px"
						height="150px"
						text="列表为空"
						textSize="18"
				>
				</u-empty>
				<view style="padding-bottom: 100rpx;">
					<u-loadmore v-if="loading" status="loading" />
					<u-loadmore v-if="isLastPage" status="nomore" />
				</view>
				<!-- 底部操作栏 -->
				<view style="height: 200rpx;"></view>
				<view class="position-fixed-bottom padding-30 bg-fff"
					@click="$tools.navigateTo('/pages/mine/mine-list/health-records/add-medication-plan')">
					<view class="btn50-0165FD-15ffffff flex-center">
						添加用药方案
					</view>
				</view>
			</view>
		</template>
		<!-- 肠道微生态 -->
		<template v-if="tabIndex == 7">
			<view class="padding-30">
				<view class="bg-fff padding-30 border-radius20 margin-bottom30">
					<view class="flex-between margin-bottom30">
						<view class="fontSize-15 color-000">肠道微生态报告</view>
						<image class="img-44" src="../../../../static/image/13.png" mode=""></image>
					</view>
					<view class="padding-30 border-radius20" style="background-color: #F3F8FF;">
						<view class="fontSize-15 color-000 margin-bottom30">排便频率：1日/1次</view>
						<view class="fontSize-15 color-000 margin-bottom30">大便形态：1级</view>
						<view class="fontSize-15 color-000 margin-bottom30">报告时间：2024-01-01</view>
					</view>
				</view>
				<view class="margin-top150" v-if="false">
					<null-view></null-view>
				</view>
				<!-- 底部操作栏 -->
				<view style="height: 200rpx;"></view>
				<view class="position-fixed-bottom padding-30 bg-fff"
					@click="$tools.navigateTo('/pages/mine/mine-list/health-records/add-ecological-report')">
					<view class="btn50-0165FD-15ffffff flex-center">
						添加生态报告
					</view>
				</view>
			</view>
		</template>
		<!-- 生活质量量表 -->
		<template v-if="tabIndex == 8">
			<view class="padding-30">
				<view class="bg-fff padding-30 border-radius20 margin-bottom30">
					<view class="flex-between margin-bottom30">
						<view class="fontSize-15 color-000">量表名称</view>
						<view class="flex-alignItems-center">
							<image class="img-44 margin-right30" @click="isShow = !isShow"
								src="../../../../static/image/15.png" mode=""></image>
							<image class="img-44" src="../../../../static/image/13.png" mode=""></image>
						</view>
					</view>
					<template v-if="isShow">
						<!-- 表格 -->
						<view class="table-scale-view margin-bottom30">
							<!-- 表头 -->
							<view class="table-scale-title">
								下列问题与便秘的症状有关，在过去的2周中，下
								面症状的严重程度或强度...
							</view>
							<!-- 表格 -->
							<view class="flex-alignItems-center table-scale-td">
								<view class="table-scale-tdLeft">感到腹胀</view>
								<view class="table-scale-tdRight">一点也不</view>
							</view>
							<view class="flex-alignItems-center table-scale-td">
								<view class="table-scale-tdLeft">感到腹胀</view>
								<view class="table-scale-tdRight">一点也不</view>
							</view>
						</view>
						<!-- 表格 -->
						<view class="table-scale-view margin-bottom30">
							<!-- 表头 -->
							<view class="table-scale-title">
								下列问题与便秘的症状有关，在过去的2周中，下
								面症状的严重程度或强度...
							</view>
							<!-- 表格 -->
							<view class="flex-alignItems-center table-scale-td">
								<view class="table-scale-tdLeft">感到腹胀</view>
								<view class="table-scale-tdRight">一点也不</view>
							</view>
							<view class="flex-alignItems-center table-scale-td">
								<view class="table-scale-tdLeft">感到腹胀</view>
								<view class="table-scale-tdRight">一点也不</view>
							</view>
						</view>
						<!-- 表格 -->
						<view class="table-scale-view">
							<!-- 表头 -->
							<view class="table-scale-title">
								下列问题关于便秘与日常生活，过去的2周里有多
								少时间...
							</view>
							<!-- 表格 -->
							<view class="flex-alignItems-center table-scale-td">
								<view class="table-scale-tdLeft">感到腹胀</view>
								<view class="table-scale-tdRight">一点也不</view>
							</view>
							<view class="flex-alignItems-center table-scale-td">
								<view class="table-scale-tdLeft">感到腹胀</view>
								<view class="table-scale-tdRight">一点也不</view>
							</view>
						</view>
					</template>
				</view>
				<view class="margin-top150" v-if="false">
					<null-view></null-view>
				</view>
				<!-- 底部操作栏 -->
				<view style="height: 200rpx;"></view>
				<view class="position-fixed-bottom padding-30 bg-fff"
					@click="$tools.navigateTo('/pages/mine/mine-list/health-records/quality-life-scale')">
					<view class="btn50-0165FD-15ffffff flex-center">
						填写生活质量量表
					</view>
				</view>
			</view>
		</template>
		<!-- 菌群移植 -->
		<template v-if="tabIndex == 9">
			<view class="padding-30">
				<view class="padding-30 flex-between bg-fff border-radius20">
					<view class="">
						<view class="flex-alignItems-center margin-bottom20">
							<view class="jun-icon"></view>
							<view class="fontSize-15 color-000">2024年1月1日</view>
						</view>
						<view class="fontSize-13 color-999">
							已做过菌群移植
						</view>
					</view>
					<view class="flex-alignItems-center">
						<image class="img-44 margin-right20" src="../../../../static/image/16.png" mode=""></image>
						<image class="img-44" src="../../../../static/image/13.png" mode=""></image>
					</view>
				</view>
				<!-- 底部操作栏 -->
				<view style="height: 200rpx;"></view>
				<view class="position-fixed-bottom padding-30 bg-fff">
					<view class="btn50-0165FD-15ffffff flex-center">
						添加菌群移植记录
					</view>
				</view>
			</view>
		</template>
		<!-- 健康数据 -->
		<u-popup :show="healthShow" :round="20" @close="healthShow = false" closeable>
			<view class="popup-view">
				<view class="fontSize-15 color-000 margin-bottom30">记录身高</view>
				<view class="flex-justAliCenter-column margin-bottom50">
					<view class="BMI-view flex-justAliCenter-column">
						<view class="fontSize-15 color-000 margin-bottom30">您的BMI</view>
						<view class="fontSize-18" style="color: #2D75E2;">{{BMIValue}}</view>
					</view>
				</view>
				<view class="input-item-view flex-alignItems-center margin-bottom30">
					<view class="fontSize-15 color-000">身高(cm)</view>
					<input type="text" class="input-view" v-model="height" placeholder="请输入" />
				</view>
				<view class="input-item-view flex-alignItems-center">
					<view class="fontSize-15 color-000">体重(kg)</view>
					<input type="text" class="input-view" v-model="weight" placeholder="请输入" />
				</view>
				<view class="btn50-0165FD-15ffffff flex-center margin-top150" @click="submitHeight">
					提交
				</view>
			</view>
		</u-popup>
		<!-- 记录血压 -->
		<u-popup :show="bloodShow" :round="20" @close="bloodShow = false" closeable>
			<view class="popup-view">
				<view class="fontSize-15 color-000 margin-bottom30">记录血压</view>
				<view class="input-item-view flex-alignItems-center margin-bottom30">
					<view class="fontSize-15 color-000">收缩压/高压(mmHg)</view>
					<input type="text" class="input-view" v-model="pressure_shou" placeholder="请输入" />
				</view>
				<view class="input-item-view flex-alignItems-center margin-bottom30">
					<view class="fontSize-15 color-000">舒张压/低压(mmHg)</view>
					<input type="text" class="input-view" v-model="pressure_shu" placeholder="请输入" />
				</view>
				<view class="input-item-view flex-alignItems-center margin-bottom30">
					<view class="fontSize-15 color-000">心率(bmp)</view>
					<input type="text" class="input-view" v-model="heart_rate" placeholder="请输入" />
				</view>
				<view class="input-item-view flex-between">
					<view class="fontSize-15 color-000">实际检测时间</view>
					<view class="flex-alignItems-center" @click="pressureDateShow = true">
						<view class="fontSize-15 color-000 margin-right10" v-if="pressureDateName">{{pressureDateName}}
						</view>
						<view class="fontSize-15 color-999 margin-right10" v-else>请选择</view>
						<u-icon name="arrow-right" color="#666666" size="18"></u-icon>
					</view>
				</view>
				<view class="btn50-0165FD-15ffffff flex-center margin-top150" @click="subHealthPressureAdd">
					提交
				</view>
			</view>
		</u-popup>
		<!-- 实际检测时间 -->
		<u-datetime-picker :maxDate="Number(new Date())" :show="pressureDateShow" v-model="pressureDateValue"
			mode="datetime" @cancel="pressureDateCancel" @confirm="pressureDateConfirm"></u-datetime-picker>
		<!-- 心率 -->
		<u-popup :show="heartRateShow" :round="20" @close="heartRateShow = false" closeable>
			<view class="popup-view">
				<view class="fontSize-15 color-000 margin-bottom30">记录心率</view>
				<view class="input-item-view flex-alignItems-center margin-bottom30">
					<view class="fontSize-15 color-000">心率(bmp)</view>
					<input type="text" class="input-view" v-model="heart_rate1" placeholder="请输入" />
				</view>
				<view class="input-item-view flex-between">
					<view class="fontSize-15 color-000">实际检测时间</view>
					<view class="flex-alignItems-center" @click="heartDateShow = true">
						<view class="fontSize-15 color-000 margin-right10" v-if="heartDateName">{{heartDateName}}</view>
						<view class="fontSize-15 color-999 margin-right10" v-else>请选择</view>
						<u-icon name="arrow-right" color="#666666" size="18"></u-icon>
					</view>
				</view>
				<view class="btn50-0165FD-15ffffff flex-center margin-top150" @click="submitHealthRateAdd">
					提交
				</view>
			</view>
		</u-popup>
		<!-- 心率实际检测时间 -->
		<u-datetime-picker :maxDate="Number(new Date())" :show="heartDateShow" v-model="heartDateValue" mode="datetime"
			@cancel="heartDateCancel" @confirm="heartDateConfirm"></u-datetime-picker>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				tabsList: [{
					name: '健康数据',
				}, {
					name: '现病史',
				}, {
					name: '健康史'
				}, {
					name: '生活方式'
				}, {
					name: '门诊记录'
				}, {
					name: '门诊报告'
				}, {
					name: '用药方案'
				}, {
					name: '肠道微生态'
				}, {
					name: '生活质量量表'
				}, {
					name: '菌群移植'
				}],
				tabIndex: 0,
				tabName: '',
				// 健康数据
				healthShow: false,
				name: '',
				// 记录血压
				bloodShow: false,
				// 心率
				heartRateShow: false,
				// 生活质量列表显示
				isShow: false,
				sick_id: '', // 就诊人id，患者id
				// 身高
				height: 0, // 身高
				weight: 0, //体重
				health_data: {},
				// 血压
				// 实际检测时间弹窗
				pressureDateShow: false, //实际检测时间弹窗
				pressureDateValue: Number(new Date()),
				pressureDateName: '',
				pressure_shou: '', // 收缩压(mmHg)
				pressure_shu: '', // 舒张压(mmHg)
				heart_rate: '', // 心率
				pressure_date: '', //血压检测时间,
				// 心率
				heartDateShow: false, //实际检测时间弹窗
				heartDateValue: Number(new Date()),
				heartDateName: '',
				heart_rate1: '', // 心率,
				// 现病史
				disease_detail: {},
				// 健康史
				history_detail: {},
				// 生活方式
				live_detail: {},
				// 列表
				page: 1,
				limit: 10,
				list: [],
				isLastPage: false,
				loading: false,
			}
		},
		onLoad() {
			if (uni.getStorageSync('patlient-item')) {
				this.sick_id = uni.getStorageSync('patlient-item').id
			}
		},
		onShow() {
			if (this.tabIndex == 0) {
				this.getHealthDetail()
			} else if (this.tabIndex == 1) {
				this.getDiseaseDetail()
			} else if (this.tabIndex == 2) {
				this.getHistoryDetail()
			} else if (this.tabIndex == 3) {
				this.getLiveDetail()
			} else if (this.tabIndex == 4) {

			} else if (this.tabIndex == 5) {
				this.page = 1
				this.limit = 10
				this.list = []
				this.tijianList()
			}else if(this.tabIndex == 6){
				
			}
		},
		// 刷新 上拉刷新
		onPullDownRefresh() {
			this.page = 1
			this.isLastPage = false
			this.list = []
			if (this.tabIndex == 5) {
				this.tijianList().finally(() => {
					// 停止当前页面下拉刷新
					uni.stopPullDownRefresh();
				});
			}else if(this.tabIndex == 6){
				this.medicineList().finally(() => {
					// 停止当前页面下拉刷新
					uni.stopPullDownRefresh();
				});
			}
		},
		// 加载下一页 下拉加载
		onReachBottom() {
			if (this.list.length >= this.page * this.limit) {
				this.isLastPage = false;
				this.page += 1;
				if (this.tabIndex == 5) {
					this.tijianList();
				}else if(this.tabIndex == 6){
					this.medicineList()
				}
			} else {
				this.isLastPage = true
			}
		},
		computed: {
			BMIValue() {
				let value = 0
				if (this.weight > 0 || this.height > 0) {
					value = (Number(this.weight) / (Number((this.height / 100)) * Number((this.height / 100)))).toFixed(1)
				} else {
					value = 0
				}
				return value
			}
		},
		methods: {
			// 删除药品用量
			medicineDel(id){
				let that = this
				uni.showModal({
					title: '提示',
					content: '是否删除该用药方案',
					success: function(res) {
						if (res.confirm) {
							that.$http.post(that.$api.medicine_del, {
								sick_id:that.sick_id,
								id: id
							}).then(res => {
								if (res.code == 1) {
									uni.showToast({
										title: '删除成功',
										icon: 'none'
									})
									that.page = 1
									that.limit = 10
									that.list = []
									that.medicineList()
								}
							})
						} else if (res.cancel) {
							uni.showToast({
								title: '取消删除',
								icon: 'none'
							})
						}
					}
				});
			},
			// 药品用量列表
			async medicineList() {
				let res = await this.$http.post(this.$api.medicine_list, {
					page: this.page,
					limit: this.limit,
					sick_id:this.sick_id
				}, {
					token: true
				})
				this.list = [...this.list, ...res.data]
			},
			// 删除门诊报告
			deleteTijianDel(id){
				let that = this
				uni.showModal({
					title: '提示',
					content: '是否删除该门诊报告记录',
					success: function(res) {
						if (res.confirm) {
							that.$http.post(that.$api.tijian_del, {
								sick_id:that.sick_id,
								id: id
							}).then(res => {
								if (res.code == 1) {
									uni.showToast({
										title: '删除成功',
										icon: 'none'
									})
									that.page = 1
									that.limit = 10
									that.list = []
									that.tijianList()
								}
							})
						} else if (res.cancel) {
							uni.showToast({
								title: '取消删除',
								icon: 'none'
							})
						}
					}
				});
			},
			// 门诊记录列表
			async tijianList() {
				let res = await this.$http.post(this.$api.tijian_list, {
					page: this.page,
					limit: this.limit,
					sick_id:this.sick_id
				}, {
					token: true
				})
				this.list = [...this.list, ...res.data]
			},
			// 获取生活方式详情
			async getLiveDetail() {
				let res = await this.$http.post(this.$api.live_detail, {
					sick_id: this.sick_id
				}, {
					token: true
				})
				if (res.code == 1) {
					this.live_detail = res.data
				}
			},
			// 获取健康病史详情
			async getHistoryDetail() {
				let res = await this.$http.post(this.$api.history_detail, {
					sick_id: this.sick_id
				}, {
					token: true
				})
				if (res.code == 1) {
					this.history_detail = res.data
				}
			},
			// 获取现病史详情
			async getDiseaseDetail() {
				let res = await this.$http.post(this.$api.disease_detail, {
					sick_id: this.sick_id
				}, {
					token: true
				})
				if (res.code == 1) {
					this.disease_detail = res.data
				}
			},
			// 提交心率
			async submitHealthRateAdd() {
				if (!this.heart_rate1) return this.$tools.toast('请添加心率')
				if (!this.heartDateName) return this.$tools.toast('请选择实际检测时间')
				let form = {
					sick_id: this.sick_id,
					heart_rate: this.heart_rate1,
					heart_date: this.heartDateName
				}
				let res = await this.$http.post(this.$api.health_rate_add, form, {
					token: true
				})
				if (res.code == 1) {
					this.$tools.toast('添加成功')
					this.heart_rate1 = ''
					this.heartDateName = ''
					this.heartRateShow = false
					this.getHealthDetail()
				}
			},
			// 确认心率时间
			heartDateConfirm(e) {
				this.heartDateName = this.$T.timeFormat(e.value)
				this.heartDateShow = false
			},
			// 取消心率时间
			heartDateCancel() {
				this.heartDateName = ''
				this.heartDateShow = false
			},
			// 确认实际检测时间
			pressureDateConfirm(e) {
				this.pressureDateName = this.$T.timeFormat(e.value)
				this.pressureDateShow = false
			},
			// 取消实际检测时间
			pressureDateCancel() {
				this.pressureDateName = ''
				this.pressureDateShow = false
			},
			// 提交血压
			async subHealthPressureAdd() {
				if (!this.pressure_shou) return this.$tools.toast('请添加收缩压(mmHg)')
				if (!this.pressure_shu) return this.$tools.toast('请添加舒张压(mmHg)')
				if (!this.heart_rate) return this.$tools.toast('请添加心率')
				if (!this.pressureDateName) return this.$tools.toast('请选择实际检测时间')
				let form = {
					sick_id: this.sick_id,
					pressure_shou: this.pressure_shou,
					pressure_shu: this.pressure_shu,
					heart_rate: this.heart_rate,
					pressure_date: this.pressureDateName
				}
				let res = await this.$http.post(this.$api.health_pressure_add, form, {
					token: true
				})
				if (res.code == 1) {
					this.$tools.toast('添加成功')
					this.pressure_shou = ''
					this.pressure_shu = ''
					this.heart_rate = ''
					this.pressureDateName = ''
					this.bloodShow = false
					this.getHealthDetail()
				}
			},
			// 获取健康数据详情信息
			async getHealthDetail() {
				let res = await this.$http.post(this.$api.health_detail, {
					sick_id: this.sick_id
				}, {
					token: true
				})
				if (res.code == 1) {
					this.health_data = res.data
				}
			},
			// 提交体重
			async submitHeight() {
				if (!this.height) return this.$tools.toast('请添加身高')
				if (!this.weight) return this.$tools.toast('请添加体重')
				let form = {
					sick_id: this.sick_id,
					height: this.height,
					weight: this.weight
				}
				let res = await this.$http.post(this.$api.health_weight_add, form, {
					token: true
				})
				if (res.code == 1) {
					this.$tools.toast('添加成功')
					this.height = ''
					this.weight = ''
					this.healthShow = false
					this.getHealthDetail()
				}
			},
			// 切换tabs
			tabsClick(e) {
				this.tabIndex = e.index
				if (this.tabIndex == 1) {
					this.getDiseaseDetail()
				} else if (this.tabIndex == 2) {
					this.getHistoryDetail()
				} else if (this.tabIndex == 3) {
					this.getLiveDetail()
				} else if(this.tabIndex ==4){
					
				}else if(this.tabIndex == 5){
					this.page = 1
					this.limit = 10
					this.list = []
					this.tijianList()
				}else if(this.tabIndex == 6){
					this.page = 1
					this.limit = 10
					this.list = []
					this.medicineList()
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	.jun-icon {
		width: 12rpx;
		height: 12rpx;
		flex-shrink: 0;
		background: #0190FD;
		border-radius: 50%;
		margin-right: 20rpx;
	}

	.table-scale-tdRight {
		flex: 1;
		padding: 20rpx;
		border-left: 1px solid #DBDBDB;
	}

	.table-scale-tdLeft {
		padding: 20rpx;
		flex: 3;
	}

	.table-scale-td:last-child {
		border-bottom: none;
	}

	.table-scale-td {
		border-bottom: 1px solid #DBDBDB;
	}

	.table-scale-title {
		background-color: #F7F7F7;
		font-size: 16px;
		color: #000000;
		padding: 30rpx;
		border-bottom: 1px solid #DBDBDB;
	}

	.table-scale-view {
		border: 1px solid #DBDBDB;
		border-radius: 20rpx;
	}

	.image-view:nth-child(3n) {
		margin-right: 0;
	}

	.image-view {
		margin: 0 20rpx 20rpx 0;
	}

	.input-item1 {
		flex: 1;
		text-align: left;
		padding: 10rpx 20rpx;
	}

	.input-demo-item {
		padding: 10rpx 20rpx;
		background-color: #F7F7F7;
		border-radius: 10rpx;
	}

	.BMI-view {
		width: 240rpx;
		height: 240rpx;
		border-radius: 50%;
		background: #FFFFFF;
		box-shadow: 0rpx 0rpx 6rpx 1rpx rgba(0, 0, 0, 0.16);
	}

	.input-item-view {
		padding: 20rpx;
		border-radius: 14rpx 14rpx 14rpx 14rpx;
		border: 1rpx solid #DBDBDB;
	}

	.input-view {
		flex: 1;
		text-align: right;
		font-size: 15px;
	}
</style>